package com.bwie.mq;

import com.bwie.pojo.po.RegistrationPo;
import com.bwie.pojo.vo.RegistrationVo;
import com.bwie.utils.SmsUtil;
import org.apache.commons.lang.SerializationUtils;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessageListener;

/**
 * @
 * @descriptions: MessageConsumer
 * @author: LiYang
 * @date: 2025/3/17 2:33
 * @version: 1.0
 */
public class MessageConsumer implements MessageListener {
    @Override
    public void onMessage(Message message) {
        byte[] body = message.getBody();
        RegistrationPo registrationVo = (RegistrationPo) SerializationUtils.deserialize(body);
        String isOk = SmsUtil.sendSmsCode(registrationVo.getPhoneNumber(), registrationVo.getRemark());
        if(isOk==null){
            isOk = SmsUtil.sendSmsCode(registrationVo.getPhoneNumber(), registrationVo.getRemark());
        }
        //短信记录表 ID 发送是否成功 发送人 手机号 发送的信息
    }
}
